﻿using System;
using System.Data;
using System.Collections;
using CE.Database;

/// <summary>
/// Summary description for MerchantCarFileUploadDB
/// </summary>
namespace CE.CarInsurance
{
    public class MerchantCarFileUploadDB
    {
        public Int64 Insert(MerchantCarFileUpload merchantcarfileupload)
        {
            MyDatabase _db = new MyDatabase("GG_MCDBConnectionString");
            Int64 _result = -1;
            string _spName = "sprocMerchantCarFileUploadDetailInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@CarId", merchantcarfileupload.CarId);
            _sPara.Add("@ProviderCompanyId", merchantcarfileupload.ProviderCompanyId);
            _sPara.Add("@InsuranceType", merchantcarfileupload.InsuranceType);
            _sPara.Add("@AgentId", merchantcarfileupload.AgentId);
            _sPara.Add("@DocRefNo", merchantcarfileupload.DocRefNo);
            _sPara.Add("@DocumentNo", merchantcarfileupload.DocumentNo);
            _sPara.Add("@FileTypeId", merchantcarfileupload.FileTypeId);
            _sPara.Add("@FileName", merchantcarfileupload.FileName);
            _sPara.Add("@OriginalName", merchantcarfileupload.OriginalName);
            _sPara.Add("@Status", merchantcarfileupload.Status);
            _sPara.Add("@TotalFiles", merchantcarfileupload.TotalFiles);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataSet GetMerchantCarFileUploadList(Int64 CarId, Int64 ProviderCompanyId)
        {
            MyDatabase _db = new MyDatabase("GG_MCDBConnectionString");
            string _spName = "sprocMerchantCarFileUploadDetailSelectItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@CarId", CarId);
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);

            DataSet _ds = _db.GetDataSet(_spName, _spara);

            return _ds;
        }

        public DataSet GetMerchantCarFileUploadList(Int64 CarId, Int64 ProviderCompanyId, string Language, Int16 Renewal)
        {
            MyDatabase _db = new MyDatabase("GG_MCDBConnectionString");
            string _spName = "sprocMerchantCarFileUploadDetailSelectItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@CarId", CarId);
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);
            _spara.Add("@Language", Language);
            _spara.Add("@Renewal", Renewal);

            DataSet _ds = _db.GetDataSet(_spName, _spara);

            return _ds;
        }

    }
}
